var map = new AMap.Map('container_map', {
	resizeEnable: true,
	center: [116.397428, 39.90923],
	zoom: 13,
	isHotspot: true
});
// var placeSearch = new AMap.PlaceSearch();  //构造地点查询类
var infoWindow = new AMap.AdvancedInfoWindow({});
map.on('hotspotover', function(result) {
	placeSearch.getDetails(result.id, function(status, result) {
		if (status === 'complete' && result.info === 'OK') {
			placeSearch_CallBack(result);
		}
	});
});
//回调函数
function placeSearch_CallBack(data) { //infoWindow.open(map, result.lnglat);
	var poiArr = data.poiList.pois;
	var location = poiArr[0].location;
	infoWindow.setContent(createContent(poiArr[0]));
	infoWindow.open(map, location);
}

function createContent(poi) { //信息窗体内容
	var s = [];
	s.push('<div class="info-title">' + poi.name + '</div><div class="info-content">' + "地址：" + poi.address);
	s.push("电话：" + poi.tel);
	s.push("类型：" + poi.type);
	s.push('<div>');
	return s.join("<br>");
}


//输入提示
var autoOptions = {
	input: "map_address"
};
var auto = new AMap.Autocomplete(autoOptions);
var placeSearch = new AMap.PlaceSearch({
	map: map
}); //构造地点查询类
AMap.event.addListener(auto, "select", select); //注册监听，当选中某条记录时会触发
function select(e) {
	placeSearch.setCity(e.poi.adcode);
	placeSearch.search(e.poi.name); //关键字查询查询
}
